Skip to content

Conversation

@mergify
Copy link

@mergify mergify bot commented Aug 28, 2024

{shutdown, Reason} must be handled into handle_call and not handle_info rabbitmqctl close_all_user_connections calls rabbit_reader which does a call into the process, the same as rabbitmq_management

Fixes #11985


This is an automatic backport of pull request #12118 done by Mergify.
This is an automatic backport of pull request #12143 done by Mergify.

dcorbacho and others added 4 commits August 28, 2024 14:45
`{shutdown, Reason}` must be handled into handle_call and not handle_info
`rabbitmqctl close_all_user_connections` calls rabbit_reader which does
a call into the process, the same as rabbitmq_management

(cherry picked from commit 494c1b8)
(cherry picked from commit 07f2026)
(cherry picked from commit ea6ef17)
(cherry picked from commit bf54a61)

# Conflicts:
#	deps/rabbitmq_mqtt/test/shared_SUITE.erl
1. Only run the CLI tests on a single node cluster. The shared_SUITE is
   already very big. Testing the same CLI commands against node-0 on a
   3-node cluster brings no benefit.
2. Move the two new CLI test cases in front of
   management_plugin_connection because they are similar in that all
   three tests close the MQTT connection.
3. There is no need to query the HTTP API for the two new CLI test
   cases.
4. There is no need to set keepalive in the two new CLI test cases.

(cherry picked from commit 69d407e)
(cherry picked from commit c2998ca)

# Conflicts:
#	deps/rabbitmq_mqtt/test/shared_SUITE.erl
1.
Prior to this commit, closing a stream connection via:
```
./sbin/rabbitmqctl close_all_user_connections guest enough
```
crashed the stream process as follows:
```
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>   crasher:
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     initial call: rabbit_stream_reader:init/1
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     pid: <0.1098.0>
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     registered_name: []
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>     exception error: no function clause matching
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                      rabbit_stream_reader:open({call,
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                 {<0.1233.0>,
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                  #Ref<0.519694519.1387790337.15898>}},
2024-08-28 13:00:18.969931+02:00 [error] <0.1098.0>                                                {shutdown,<<"enough">>},
```

This commit fixes this crash.

2.
Both CLI commands and management plugin use the same way
to close MQTT, Web MQTT, and Stream connections: They all send a message
via `Pid ! {shutdown, Reason}` to the connection.

3.
This commit avoids making `rabbit` core app to know about
'Web MQTT'.

4
This commit simplifies rabbit_mqtt_reader by avoiding another
handle_call clause

(cherry picked from commit 8c905b9)
(cherry picked from commit 055fb6e)
@mergify mergify bot added the conflicts label Aug 28, 2024
@mergify
Copy link
Author

mergify bot commented Aug 28, 2024

Cherry-pick of bf54a61 has failed:

On branch mergify/bp/v3.13.x/pr-12143
Your branch is ahead of 'origin/v3.13.x' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit bf54a61ed8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   deps/rabbit/src/rabbit_connection_tracking.erl
	modified:   deps/rabbit/src/rabbit_networking.erl

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbitmq_mqtt/test/shared_SUITE.erl

Cherry-pick of c2998ca has failed:

On branch mergify/bp/v3.13.x/pr-12143
Your branch is ahead of 'origin/v3.13.x' by 2 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit c2998ca17a.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbitmq_mqtt/test/shared_SUITE.erl

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

ansd added a commit that referenced this pull request Aug 28, 2024
This commit fixes #11985
and is a manual backport due to conflicts in
#12144
@ansd
Copy link
Member

ansd commented Aug 28, 2024

Closing in favour of #12145

@ansd ansd closed this Aug 28, 2024
@mergify mergify bot deleted the mergify/bp/v3.13.x/pr-12143 branch August 28, 2024 14:53
ansd added a commit that referenced this pull request Aug 28, 2024
This commit fixes #11985
and is a manual backport due to conflicts in
#12144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants